package info.nene_loveplus.controller.pub;

import info.nene_loveplus.model.blog.Entry;
import info.nene_loveplus.service.BlogService;

import java.util.logging.Logger;

import org.slim3.controller.Navigation;

import com.google.appengine.repackaged.com.google.common.collect.Lists;

public class SingleController extends AbstractPubController {

	private BlogService blogService = new BlogService();

	private Logger logger = Logger.getLogger(SingleController.class.getName());

	@Override
	public Navigation doRun() throws Exception {
		logger.fine("single start (key = " + asString("key") + ")");

		Entry e = blogService.findById(asString("key"));
		requestScope("list", Lists.newArrayList(e));
		requestScope("single", true);

		return forward("index.jsp");
	}
}
